Application Changes
Since the GX printing architecture will no longer be supported for Mac OS, any software
that does not already have a solution using classic QuickDraw printing will need to be updated.
For the majority of applications, the recommended solution for Mac OS 8.0 is to use the
QuickTime compression/decompression mechanism for imaging QuickDraw GX data. The basic
technique is to encapsulate the QuickDraw GX image in a compressed data format using the
object flattening functions from QuickDraw GX. Once the compressed image data is created,
it may be passed to the QuickDraw GX codec and drawn using the QuickTime image compression
functions or embedded within a QuickDraw picture and drawn using the DrawPicture function.
In either case, the compressed data is passed to the the low-level QuickDraw drawing
routines through the StdPix bottleneck routine. StdPix decompresses the data using the
QuickDraw GX codec and passes the decompressed data to the bitsProc bottleneck routine
when rendering the image.
LaserWriter drivers starting with version 8.3 recognize compressed data that may
be drawn using QuickTime, like QuickDraw GX flattened objects. For Mac OS 8.0, the
LaserWriter driver has been modified to render the QuickDraw GX data at the device
resolution of the printer. When despooling, the printer driver changes the resolution
of the offscreen drawing port and uses the QuicDraw GX codec to rasterize the compressed data.
The QuickDraw printer drivers from Apple render the compressed data during spooling and use
the resolution of the active graphics port. Application developers may wish to use the device
resolution commands of the PrGeneral routine to improve the quality of their printed images
as described in "Meet PrGeneral, the Trap That Makes the Most of the Printing Manager,"
in develop 3.
General Changes For All Applications
The sample code for this Technote includes updated versions of three QuickDraw GX
user libraries, CodecLibrary , PrintingLibrary , and StorageLibrary ,
that may be used to
simplify the conversion of your software. The TwoFace sample application supports the
basic job, format, dialog, and spooling functions of the QuickDraw GX Printing Manager.
It uses an abstraction layer provided by the PrintingLibrary to handle printing through
the QuickDraw GX and classic QuickDraw printing architectures, depending on which environment
is available when the application is launched. All the changes described in this section are
handled automatically by the user libraries if you simply convert any references to the
QuickDraw GX Printing Manager, including the gxJob and gxFormat data types, to the equivalent
functions and data types of the PrintingLibrary .
- Check the correct gestalt selector. Use the individual grfx and pmgr gestalt selectors rather
than the obsolete qdgx gestalt selector.
Boolean gPrintingArchitecture = false;
long theFeature;
if ( Gestalt(gestaltGraphicsVersion, &theFeature) != noErr )
return;
if ( Gestalt(gestaltGXPrintingMgrVersion, &theFeature) != noErr )
gPrintingArchitecture = kQDPrArch;
else
gPrintingArchitecture = kGXPrArch;
- For 68000 applications that use A-trap addresses to determine which parts of the GX environment are
installed, use the individual gestalt selectors instead. This technique is not recommended but has been
used by some applications in the past. If this is the case for your application, verify that you are
checking the correct A-trap addresses:
Trap Address |
Technology |
ABFE |
GX Printing |
A832 |
GX Graphics |
ABF6 |
Collections Manager |
- During initialization of a PowerPC application, check if the QuickDraw GX Printing library is
installed. If the application is "weak" linked to the library, the Process Manager will launch it even
if the library is missing, although the Code Fragment Manager will not resolve the addresses of the
functions in the library. If the application calls any of these functions, it will crash. Your
application should check if any of the Printing Manager functions cannot be resolved and exit gracefully
if the library is missing. Note that the check could be performed against any function you call in the
library.
GXInitPrinting is often the first function that is called from the Printing Manager,
so it is convenient.
if ( (UInt32)GXInitPrinting == kUnresolvedCFragSymbolAddress )
gPrintingArchitecture = kQDPrArch;
- During printing, create a single picture shape for the contents of each page in the document.
The
PrintingLibrary includes a sample viewport filter function that handles this task from
within the printing loop.
- Use
GXFlattenShape to create the compressed data for the QuickDraw GX codec.
GXFlattenShape is described in detail in
Inside Macintosh: QuickDraw GX Objects
2-88 to 2-89.
- Use
DecompressImage as described in Printing Images Faster With Data Compression,
in develop 24
(December 1995) to create the QuickDraw picture with the embedded QuickDraw GX data. When the application
calls the standard DrawPicture function to display the image containing the compressed
QuickDraw GX data,
the StdPix function decompresses the image by invoking the Image Compression Manager.
This may be performed from within a classic printing loop as outlined in
"A Printing Loop That Cares";,
in Technote 1092. The CodecLibrary implements a function, GXCdShapeToPicture ,
that encodes the
QuickDraw GX data as QuickTime compressed data and creates a PicHandle ; an application may use this
routine to create a QuickDraw picture prior to entering the printing loop or to convert a QuickDraw GX
document to the QuickDraw PICT file format. DecompressImage is described in detail in
Inside Macintosh: QuickTime,
pages 3-78 to 3-79.
- An alternative to Step 6 is to pass the flattened QuickDraw GX data directly to the
custom
StdPix bottleneck installed by the printer driver during printing. The
CodecLibrary implements a function, GXCdDrawShape , that converts the
QuickDraw GX data to a QuickTime encoded PixMap data structure, which it passes to the QuickDraw GX
codec from within the printing loop.
StdPix is described in detail in Inside Macintosh: QuickTime, pages 3-138 to 3-139.
Specific Changes Required Based on Level of Support
Here is an outline of the changes GX applications will need to make.
They are outlined according to the level of GX support.
GX Unaware (no knowledge of GX)
GX Aware ( implements core GX Printing features)
- Classic Printing code should be added using the new printing user library. (Step 1-7)
GX Savvy (implements support for Graphics, Typography and Printing)
- Classic Printing code should be added using the new printing user library. (Step 1-7)
GX Dependent (requires GX to be installed to function)
- Classic Printing code should be added using the new printing user library. (Step 1-7)
Additional Changes
Custom Page formatting:
- Currently, applications that wish to implement custom page formatting will have to spool
multiple jobs per document. One job for each change in the page formatting.
It is important to note, that even today - on System 7.5.x - it is possible for an application
using GXGraphics 1.1.x to print using the classic printing mechanism described above.
GX Printing Extension Changes
Printing extensions have been used for a wide variety of things in the history of GXPrinting.
However, despite their potential for optimizing printing from certain kinds of applications,
they have never been developed or used to their full potential by many developers. Unfortunately,
under the new GX model , GX extensions are no longer available. Some of the functionality that
developers have used GX extensions for can be rolled into classic applications or drivers, but
that will have to be determined by the developer on a case-by-case basis.
GX Printer Driver Changes
Under the new GX model, GX printer drivers will no longer be supported. There is no transition
plan for these drivers.
Classic Printer Driver Changes
In the world of GXGraphics 1.1.6 it will be desirable to print GX objects to classic printer
drivers.
Raster:
For raster printer drivers, the output from an updated GX application should match the high quality
output today from GX drivers.
PostScript:
For PostScript printer drivers however, there will be some changes required to add support for
printing high-quality GX objects. We are currently working on determining what the best delivery
mechanism for these changes will be (a library, an new API, atc.). As soon as we have a better
idea of how to do this, we will update this Technote to reflect the necessary changes.
PDD Changes
Under the new GX architecture, there is no way to author PDD documents. Also, SimpleText
will not display PDD's under QuickDraw GX 1.1.6. You should convert PDD files to a different
format, such as Adobe Acrobat PDF files, before attempting to use them with Mac OS 8 or QuickDraw GX
1.1.6.
Incompatibilities and Limitations
This section describes the known incompatibilities and limitations, and their solutions for
the GXGraphics 1.1.6 extension:
- Current versions of printer drivers may generate large spool files and take a long time to print when
printing documents containing QuickDraw GX data. In addition, QuickDraw GX data printed to the Apple
Color LaserWriter may be printed at less than full printer resolution. These problems will be
addressed in future versions of printer drivers from Apple and other vendors.
- With ATM 4.0.2, some PDF documents that use ATM substitution fonts may not print correctly using the
LaserWriter 8 driver. This problem will be fixed in a future version of LaserWriter 8 which will be
available in late summer 1997.
- ATM 3.8.3 and 4.0 do not currently recognize that QuickDraw GX is installed when the GXGraphics
extension is in your user's system. This causes problems with Type-1 enabled fonts. This problem has been
fixed with the 4.0.2 release of ATM by Adobe Systems. Check with Adobe for a newer version of ATM Deluxe.
- Some older QuickDraw pictures with embedded QuickDraw GX data may print with random noise in the
background of the picture. This problem will be fixed in a future version of QuickTime.
- Some QuickDraw GX data may print incorrectly in low memory conditions. You may notice that parts of
the image repeat rather than the entire image printing correctly. This problem is in the QuickDraw GX
QuickTime Codec and will be fixed in a future version of QuickTime.
Where to Get GXGraphics 1.1.6 and How to License it
The GXGraphics 1.1.6 extension:
- GXGraphics 1.1.6 is only available as part of the MacOS 8.0 package. It is equivalent to the
GXGraphics 1.1.3 release with a new installer and PPC library changes.
Software Licensing:
- For developers who wish to ship the GXGraphics extension with their product, you must contact
Software Licensing at sw.license@apple.com or call them
at 512-919-2645. Reference the QuickDraw GX
software license to make sure you get the appropriate licensing agreement.
Summary
By simply following the above steps, you should easily be able to convert your GX
applications into a viewable applications that your users will be able to use without
having the complete GX extension installed.
|